#!/bin/bash

rm -rf $2 &> /dev/null
mkdir $2

YUAN=`du -s $1|awk '{print $1}'`

cp -rf $1 $2  &
INTERVAL=0.1
TCOUNT="0"
while :
do
        MUBIAO=`du -s $3|awk '{print $1}'`
        PERCENT=`echo "scale=1;$MUBIAO/$YUAN*100"|bc`
        if [ $p != "100.0" ]
        then
        TCOUNT=`expr $TCOUNT + 1`
        case $TCOUNT in
        "1")
                echo -e '-'"\b\c"
                sleep $INTERVAL
                ;;
        "2")
                echo -e '\\'"\b\c"
                sleep $INTERVAL
                ;;
        "3")
                echo -e "|\b\c"
                sleep $INTERVAL
                ;;
        "4")
                echo -e "/\b\c"
                sleep $INTERVAL
                ;;
        *)
                TCOUNT="0";;
        esac
        else
                break
        fi
done
                   